<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('users/setSignory')}">
            <div class="form-group">
				<label for="input-user_nickname" class="col-sm-2 control-label"><span class="form-required">*</span>身份标识</label>
				<div class="col-md-6 col-sm-10">
                    <volist name="list" id="v">
                    <!-- <label class="checkbox-inline"><input type="checkbox" value="{$v['id']}" name="identity" <in name="v['id']" value="$data['identity']">checked="checked"</in> >{$v['name']}</label> -->
                    
                    <label class="radio-inline"><input type="radio" value="{$v['id']}" name="identity" <in name="v['id']" value="$data['identity']">checked="checked"</in> >{$v['name']}</label>
                    </volist>
				</div>
			</div>            

            <div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<input type="hidden" name="id" id="id" value="{$data.id}" />
					<a href='javascript:void(0)' class="btn btn-primary js-ajax">{:lang('EDIT')}</a>
				</div>
			</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
    <script>
        Wind.use('layer');
        (function(){
            var status=0;
            $('.js-ajax').click(function(){
                if(status==1){
                    return !1;
                }
                var id=$('#id').val();
                var identitys='';
                
                $("input[name='identity']:checked").each(function(i){
                    if(i==0){
                        identitys += $(this).val();
                    }else{
                        identitys += ',' + $(this).val();
                    }
                });
                
                status=1;
                $.ajax({
                    url: '{:url('admin/users/setIdentity')}',
                    type: 'POST',
                    dataType: 'json',
                    data: {id:id,identitys: identitys},
                    success:function(data){
                        status=0;
                        var code=data.code;
                        if(code==0){
                            layer.msg(data.msg);
                            return !1;
                        }
                        
                        layer.msg("操作成功",{},function(){
                            parent.layer.closeAll();
                            parent.reloadPage(parent.window);
                        });
                    },
                    error:function(e){
                        status=0;
                    }
                });
            
            });
        })()
    </script>
</body>
</html>